#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "HuJiang";

'''
python 基础练习
'''

# ======== 函数 ========
def fun_01():
    print("hello world");

# 位置参数
def fun_02(name, age=18):
    print(name, age);

# 可变参数
def fun_03(*args):
    print(args);

# 可变关键字参数
def func_04(**kwargs):
    print(kwargs);

# 命名关键字参数
def fun_05(name, *, age):
    print(name, age);

#组合参数，定义函数，参数尽可能简单，尽可能不使用组合参数

# 函数单一返回值
def fun_06():
    return "cdscdas";

# 函数多返回值
def fun_07():
    return "cdascda", 68, True;

# 空函数
def fun_08():
    pass;

# 递归函数：自己调用自己、设置跳出循环的条件
def fun_09(num):
    if num == 1:
        return num;
    return num * fun_09(num - 1);

# ======== 类 ========
class User(object):
    def __init__(self, user_name, password, email):
        self.user_name = user_name;
        self.password = password;
        self.email = email;

    def get_user_name(self):
        return self.user_name;

    def set_user_name(self, user_name):
        self.user_name = user_name;

    def login(self, user_name, password):
        pass;

if __name__ == '__main__':
    user = User("hj", "111111", "hj@163.com");
    print(user.user_name);
    print(user.__dict__);